package org.boot.myledger.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.boot.myledger.entity.BudgetType;
import org.boot.myledger.entity.User;
import org.boot.myledger.service.BudgetTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: liupy
 * @Date: 2024/3/27
 * 收付信息
 */
@RestController
@RequestMapping("/budget")
@Api("收付相关内容模块")
@Slf4j
public class BudgetController {

    @Autowired
    private BudgetTypeService budgetTypeService;

    @GetMapping(value = "/test",produces = "application/json;charset=UTF-8")
    public User test() {
        User user = new User();
        user.setSex(1);
        user.setUsername("张飒");
        return user;
    }

    // 查询所有支付类型
    @ApiOperation(value = "查询所有支付类型")
    @GetMapping("/findAllType")
    public List<BudgetType> findAllType() {
        log.info("查询所有支付类型,共有" + budgetTypeService.findAllType().size() + "条数据");
        return budgetTypeService.findAllType();
    }
}
